<?php

namespace app\controller;
use AlipayConfig;

class Alipay
{
    //支付宝支付配置
    public function getAlipayConfig(): AlipayConfig
    {

        //$privateKey  = '<-- 请填写您的应用私钥，例如：MIIEvQIBADANB ... ... -->';
        //$alipayPublicKey = '<-- 请填写您的支付宝公钥，例如：MIIBIjANBg... -->';
        //$aop = new AopCertClient();
        $alipayConfig = new AlipayConfig();
        $alipayConfig->setServerUrl('https://openapi.alipay.com/gateway.do');  //$alipayConfig->setServerUrl('https://openapi.alipay.com/gateway.do');
        $alipayConfig->setAppId('2021005123629007');
        $alipayConfig->setPrivateKey("MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCP/WmO38rOVkjKWnIO6uqJtY+forK96KunJsJLslnZuaWRJ8iOzmjIPDnS2+s03pxm3iwU3ZIEuaOOxUs5TFArN893mo7OhqTTc52HuHNbVT7QkvFGZB5FtcfW8AhJBgfdTAGoq6FvQRCL4h7NYI0bLvGyTsYcv4O/sZdF7mkw1K538tWC2ezx3b5+G/T1vs9FNXWvbCj+U2aNnZ18vLXhCsUusx5uFapfDmEg9/FxL3hejY4TF1XWaoYC45IKvPE8M6Ep8sj/DVpi9yDeRb/shuby+zD6079MTexu1jLx2tqIu8I8QWta/UnTfHCb7nhoaQZGL5wo1mCzjAN5Kmi7AgMBAAECggEASQmW8LUN72oPFC2aq3x3qZCiIKxrlC8gWvIrHjCCqRElLaMLdXy349HA1vdcsH22wesyWwclGSZ9E196T78o7zMpFpcclx/vHZ8Iqh5izVJJQY03u6fvPxb9Hka1PS1E8fiq4r7kbUWIuhvh2fV+veorCXIxxcVTc/oGLJ/JVc3ZNvs+1Jx2lSjb6fO6hW41As9M+RZ+HGzhz7tOI5EMEbtrVALd6aB8F3AlbbGjvPS/fky4FY2GkUBJkw7uicHFqHABmCkCn3G6SiU33P6bYhfloQI5izfqOX/+VeQvz1bR9PzW45bROm5m8DLN+LUMIFkgPCjSlOg6Q+uphhFEKQKBgQDE796nqqGvVK2WXBQyN8LmI+FA+EHuo4jZLCSR18ydlcM0UyaZ8ow0FAddRRw3xAv91NLfXcxHrZr3wnyuN5eS6bBbXRScgvE34YxLkgdXlrB+aNBlmkk5XKbfya+xAL+IQflxKcnsVCCONlUUhR4/9ouFcGIUcAAMJkRJ9/X5BQKBgQC7LHNJSK5RDc1elFw0bcgUlgiAFq7V2+N+WgR6eedrN/4pI5TR04gf0hNiOfxJ+HrrJ7f4Arp6b3Ozd5sFLf2g9spSFPVwlIDpENOiXs6UkE7eFCzySUP61QdpYT9x/zmrEaPYZW412epEpW8lWueAYh1yYOFO2HFsqYMaRKmGvwKBgBoLStvLkgRY43f+B2G4xBqhZhmsezOvBtsJnnB3JIU2mBEkafdz/xyoBW1NRXUOhTN1YMnPYsOb7uGTI9/6VB5Gr171yVMFchccyev4jOYFdKPTArRdGg/u89ammoiC+9FuQCm6CA0r9v43qzrCfASje0ITYbUoNqlkqiVKGIptAoGAbhCDcpKkvtEI9Rb06Xes8j4PnZK5GNUG/6PbglHw/aGdeX+M4Z4sK9oSv+4tJypQzbs7eUHRenHTbbNlmzQiMucsrfvZIGyTKXpVmON7Qu1hE0J187uVmAhxJUykTFqzBJ+I45Uxq8UK93b41tSP0XTgsAO8OesZN7aue2Ho9m0CgYB/KnQPs2rshTM+YAUuePPhUsZydJvxykUsB8vqjatCYrDxQRTtI9JpDWNZN85QyY+J/oEw0eSa3zWPRU5mgGw22B40qlyFpnNZaX1R38HlwCivcAaSWnbXGW0GhEhVrOgxJLMiMhRAhlVyWTrCksucVnzC/7I+YuxokXd17MD3IQ==");
        $alipayConfig->setFormat('json');
        $alipayConfig->setCharset('UTF-8');
        $alipayConfig->setSignType('RSA2');
        $alipayConfig->setAppId('2021005123629007');
        //$alipayPublicKey = app()->getAppPath().'alipay\alipayCertPublicKey_RSA2.crt';
        //$alipayConfig->setAlipayPublicCertPath($alipayPublicKey);
        //$publicCertPath=app()->getAppPath().'alipay\alipayCertPublicKey_RSA2.crt';
        //$alipayRsaPublicKey = $aop->getPublicKey($publicCertPath);
        $alipayConfig->setAlipayPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx24p6IrSAtBhKLzFzXqAnP/KcR6UhFaB6o/a5ZRqyPByZgYVVd7JPfdavaAYCUdBLqIiTgrw4t3uNXTFYuxEeV7bZMyXc4p7Zu/cgzSED5fszrtCHeq7DXKYnRw8ZoISf4rxkJhz/3G9CIXz48oCN3XfK1dWUVTi64Z9lLtkEPXeZNNupUJ2uDXsicYMeuR4cwkVqMQ1UWuYUeX9xx571oKAdKmab4Kv/kBVwAQlVGmAOg/0pxm9o0Tc0JxEYDmGmGcP8TyTmdEy1i7vA3HDW8LQkz51aysPDzkrBxdAwYBbz7Iy84YBKAAIdghcgCXBQTeLG9RwjYAKGHKqa/F7vQIDAQAB");
        return $alipayConfig;
    }
}